wayland: Keep the last cursor on leave, try to restore it on enter
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 1 Sep 2014 16:53:00 +0000 (18:53 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 1 Sep 2014 18:46:29 +0000 (20:46 +0200)
On DnD, pointer_handle_leave may be triggered without the pointer actually
leaving the window, and pointer_handle_enter() happening after intra-window
DnD won't actually manage to update the cursor (it does nothing directly,
and to the upper layers the cursor is still the same and consistent, so no
attempt will happen).

To fix this, keep the pointer cursor on leave, and ensure it is updated
on enter. The pointer cursor will be updated to any current new one through
the enter/motion events generated if it needs be.

https://bugzilla.gnome.org/show_bug.cgi?id=735831

gdk/wayland/gdkdevice-wayland.c

index 4e773179c2daebf1cd504f2e45fddfb5927cabeb..d6dafeec69bd675741818efee1cf71de97f4be12 100644 (file)
@@ -684,6 +684,8 @@ pointer_handle_enter (void              *data,
   event->crossing.focus = TRUE;
   event->crossing.state = 0;
 
+  gdk_wayland_device_update_window_cursor (device);
+
   get_coordinates (device,
                    &event->crossing.x,
                    &event->crossing.y,
@@ -728,6 +730,8 @@ pointer_handle_leave (void              *data,
   event->crossing.focus = TRUE;
   event->crossing.state = 0;
 
+  gdk_wayland_device_update_window_cursor (device);
+
   get_coordinates (device,
                    &event->crossing.x,
                    &event->crossing.y,
@@ -742,11 +746,7 @@ pointer_handle_leave (void              *data,
 
   g_object_unref(device->pointer_focus);
   if (device->cursor)
-    {
-      gdk_wayland_device_stop_window_cursor_animation (device);
-      g_object_unref (device->cursor);
-      device->cursor = NULL;
-    }
+    gdk_wayland_device_stop_window_cursor_animation (device);
 
   device->pointer_focus = NULL;
 }